﻿function NavigationBarControl(barId, getDataFunc) {

    var self = this;
    self.barId = barId;
    self.getDataFunc = getDataFunc;

    self.prevButtonSelector = '#prev-button-' + self.barId;
    self.nextButtonSelector = '#next-button-' + self.barId;
    self.firstItemTextSelector = '#first-item-' + self.barId;
    self.lastItemTextSelector = '#last-item-' + self.barId;
    self.totalItemsTextSelector = '#total-items-' + self.barId;

    $(self.prevButtonSelector).click(function () {
        self.getDataFunc(1);
    });

    $(self.nextButtonSelector).click(function () {
        self.getDataFunc(2);
    });

    $(self.firstItemTextSelector).text(1);
    $(self.lastItemTextSelector).text(2);
    $(self.totalItemsTextSelector).text(10);
}